<script setup lang="ts" name='index'>
import { ref, reactive, onMounted } from "vue";

import { useRouter } from "vue-router";
import { page, deleteById as del, queryById, saveOrUpdate, type PageInfo } from '@/utils/crud'

const router = useRouter()

const total = ref(0);
const loading = ref(false);

const registId = ref('');
const registerList = ref<any[]>([]);
const queryParam = reactive({
    current: 1,
    size: 10,
    name: '',
});//根据病历号 查询患者信息
function queryRegister() {


    page<any>('/yiji/registPage', queryParam).then(function (page) {
        registerList.value = page.data;
        total.value = page.total;
        loading.value = false;
    })

}


/**
 * 根据患者 查询 所有的 申请检查项目
 * @param scope 
 * @param row 
 * @param registId 
 */
function queryRegisterCheckApply(registId: string) {

    console.log("router.getRoutes", router.getRoutes())

    router.push({
        path: '/home/checkapplylist',
        query: {
            registId
        }
    })



}


onMounted(() => {

    ////
    queryRegister()
})

</script>

<template>

    <el-row>
        <el-col :span="5">
            <el-input v-model="queryParam.name" clearable placeholder="请输入患者姓名" />

        </el-col>

        <el-col :span="5">

            <el-button @click="queryRegister">查询</el-button>

        </el-col>

    </el-row>

    <el-table :data="registerList">
        <el-table-column prop="registId" label="病历号"></el-table-column>
        <el-table-column prop="name" label="姓名"></el-table-column>
        <el-table-column prop="age" label="年龄"></el-table-column>
        <el-table-column prop="visitTime" label="看诊时间"></el-table-column>
        <el-table-column prop="registId" label="操作">
            <template #default="scope">
                <!-- {{ scope.row }} -->
                <el-button type="primary" link @click="queryRegisterCheckApply(scope.row.registId)">查询患者检查信息</el-button>
            </template>



        </el-table-column>




    </el-table>
    <el-pagination v-model:current-page="queryParam.current" :page-sizes="[3, 5, 10, 15, 20, 30, 40]"
        v-model:page-size="queryParam.size" size="default" layout="sizes, prev, pager, next" :total="total"
        @size-change="queryRegister" @current-change="queryRegister" />




</template>



<style scoped></style>